/**   
* @Title: PaiDanSheZhiController.java 
* @Package com.zjdiepu.www.manage.api.zpp.controller 
* 
* @author zhangpp
* @date 2017年6月1日 下午3:10:27 
* @version V1.0   
*/
package com.zjdiepu.www.manage.api.zpp.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import springfox.documentation.annotations.ApiIgnore;

import com.zjdiepu.www.base.BaseController;
import com.zjdiepu.www.base.core.AbstractSysUser;
import com.zjdiepu.www.base.core.ApiResponse;
import com.zjdiepu.www.base.core.PageVo;
import com.zjdiepu.www.common.util.CollectionInitUtil;
import com.zjdiepu.www.ibiz.fk.IFkAuditListService;
import com.zjdiepu.www.ibiz.zpp.PaiDanSheZhiService;
import com.zjdiepu.www.ibiz.zpp.YwShenQingZxService;
import com.zjdiepu.www.model.fk.dto.FkAuditList;
import com.zjdiepu.www.model.fk.ext.FkAuditListExt;
import com.zjdiepu.www.model.zpp.fksh.ext.ParamsExt;
import com.zjdiepu.www.model.zpp.fksh.vo.ParamsVo;

/**      
 * 项目名称：diepu-parent-manage   
 * 类名称：PaiDanSheZhiController   
 * 类描述：   
 * 创建人：zhangpp
 * 创建时间：2017年6月1日 下午3:10:27   
 * 修改人：zhangpp
 * 修改时间：2017年6月1日 下午3:10:27   
 * 修改备注：   
 * @version V1.0     
 */
@RestController
@RequestMapping(value= "PaiDanSheZhiController", produces="application/json;charset=UTF-8")
@Api(tags = {"作者：张鹏鹏，电话：15158822934"}, produces="application/json;charset=UTF-8")
public class PaiDanSheZhiController extends BaseController
{
	@Resource
	private IFkAuditListService fkAuditListService;
	 
	@Resource
	private YwShenQingZxService ywShenQingZxService;
	
	@Resource
	private PaiDanSheZhiService paiDanSheZhiService;
	
	
	/**
	* 派单设置  电审二审派单
	* @author zhangpp
	* @Title: paiDanSheZhiDianShenErShenPaiDanSave 
	* 
	* @param @param paramsExt
	* @param @return
	* @param @throws Exception    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@RequestMapping(value="paiDanSheZhiDianShenErShenPaiDanSave",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public ApiResponse paiDanSheZhiDianShenErShenPaiDanSave(@ApiIgnore com.zjdiepu.www.model.zpp.pub.ext.ParamsExt paramsExt) throws Exception
	{
		AbstractSysUser currentUser = getCurrentUser();
		paiDanSheZhiService.diepuPaiDanSheZhiDianShenErShenPaiDanSave(paramsExt, currentUser);
		return ApiResponse.success(true);
	}
	
	
	/**
	* 派单设置  电审一审派单
	* @author zhangpp
	* @Title: paiDanSheZhiDianShenYiShenPaiDanSave 
	* 
	* @param @param paramsExt
	* @param @return
	* @param @throws Exception    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
	@RequestMapping(value="paiDanSheZhiDianShenYiShenPaiDanSave",method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public ApiResponse paiDanSheZhiDianShenYiShenPaiDanSave(@ApiIgnore com.zjdiepu.www.model.zpp.pub.ext.ParamsExt paramsExt) throws Exception
	{
		AbstractSysUser currentUser = getCurrentUser();
		paiDanSheZhiService.diepuPaiDanSheZhiDianShenYiShenPaiDanSave(paramsExt, currentUser);
		return ApiResponse.success(true);
	}
	
	/**
	* 派单设置/电审一审派单
	* @author zhangpp
	* @Title: paiDanSheZhiDianShenPaiDanList 
	* 
	* @param @param fkAuditListExt
	* @param @return    设定文件 
	* @return ApiResponse    返回类型 
	* @version V1.0
	* @throws
	 */
    @ApiOperation(value = "派单设置/电审一审派单",response = FkAuditList.class, httpMethod="POST", tags={"派单设置/电审一审派单"})
    @RequestMapping(value = "paiDanSheZhiDianShenPaiDanList", method = RequestMethod.POST)
    public Map<String, Object> paiDanSheZhiDianShenPaiDanList(@ModelAttribute FkAuditListExt fkAuditListExt,ParamsExt paramsExt)
    {
    	 Map<String, Object> maps = success();
    	 fkAuditListExt.notDeleted();
         PageVo page = getPage(fkAuditListExt);
         int records = fkAuditListService.countByExt(fkAuditListExt);
         page.setRecords(records);
         if (records > 0) {
             List<FkAuditList> fkAuditLists = fkAuditListService.selectByExt(fkAuditListExt);
             page.setRows(fkAuditLists);
         } else {
             page.setRows(CollectionInitUtil.emptyList());
         }
         maps.put("result", page);
         
         List<ParamsVo> paramsVo = ywShenQingZxService.getOpList(paramsExt);
         maps.put("paramsVo", paramsVo);
		return maps;
    }
}
